In addition to the default styles, Silverlight Elements includes a number of styles that you can use to give your applications an attractive Office- or Blend-style theme.
There are five custom styles available. To use a custom style, merge the style’s resource dictionary into your resources, and reference the relevant style name when defining your controls.
To merge a style’s resource dictionary into your resources, use the ResourceDictionary.MergedDictionaries property. The Source for the merged dictionary should be /Mindscape/SilverlightElements;component/Themes/style.xaml where style.xaml is one of the following XAML file names:
- Alloy.xaml – Dark, flat interface similar to Expression Blend
- AlloyLight.xaml – Lighter, flat grey interface similar to alternative Blend style
- OfficeBlack.xaml – Smooth 3D interface with black highlights similar to Office 2010
- OfficeBlue.xaml – Smooth 3D interface with blue highlights similar to Office 2010
- OfficeSilver.xaml – Smooth 3D interface with silver/grey highlights similar to Office 2010
For example:
<UserControl.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="/Mindscape.SilverlightElements;component/Themes/OfficeBlue.xaml" /> </ResourceDictionary.MergedDictionaries> <!-- Your own resources here --> </ResourceDictionary> </UserControl.Resources>
To apply the style to a control, set the control’s Style property. Note that this much be done on each control. For example:
<ms:Scheduler Style="{StaticResource SchedulerStyle}" />
The resource keys for the various controls are as follows:
Control | Style Key |
---|---|
ColorPicker | ColorPickerStyle |
DualProgressBar | DualProgressBarStyle |
DualSlider | DualSliderStyle |
Expander | ExpanderStyle |
Menu | MenuStyle |
ListView | ListViewStyle |
MulticolumnTreeView | MulticolumnTreeViewStyle |
NumericUpDown | NumericUpDownStyle |
OutlookBar | OutlookBarStyle |
PaletteColorPicker | PaletteColorPickerStyle |
Scheduler | SchedulerStyle |
Slider | SliderStyle |
SplitButton | SplitButtonStyle |
StandardRichTextEditorToolBar | HtmlEditorToolBarStyle |
TimePicker | TimePickerStyle |
TimeSpanPicker | TimeSpanPickerStyle |